from appium.webdriver.common.mobileby import MobileBy

from app.base_page import BasePage


class EditMemberPage(BasePage):
    # 编辑成员信息保存成功
    def edit_member_success(self,name,phonenum,address):
        # 输入姓名
        self.find_and_send(MobileBy.XPATH, "//*[@text='必填']",name)
        # 输入手机号
        self.find_and_send(MobileBy.XPATH, "//*[@text='手机号']",phonenum)
        # 添加地址
        self.find_and_click(MobileBy.XPATH, "//*[@text='地址']/../android.widget.RelativeLayout")
        self.find_and_send(MobileBy.XPATH, "//*[@resource-id='com.tencent.wework:id/gz']",address)
        self.find_and_click(MobileBy.XPATH, "//*[@text='确定']")
        # 点击保存
        self.find_and_click(MobileBy.XPATH, "//*[@text='保存']").click()
        from app.addmember_page import AddMemberPage
        return AddMemberPage(self.driver)

    # 删除成员
    def delet_member(self):
        self.find_and_click(MobileBy.XPATH,"//*[@text='删除成员']")
        self.find_and_click(MobileBy.XPATH,"//*[@text='确定']")
        from app.contract_page import ContractPage
        return ContractPage()